package com.macro.mall.portal.util;

public class AccessToken {

    // 获取到的凭证
    private String token;

    // 凭证有效时间，单位：秒
    private long expiresTime;

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public long getExpiresTime() {
        return expiresTime;
    }

    public void setExpiresTime(long expiresTime) {
        this.expiresTime = expiresTime;
    }


    public AccessToken(String token, int expiresIn) {
        this.token = token;
        expiresTime = System.currentTimeMillis() + expiresIn * 1000;
    }

    /**
     * 判断是否过期
     * @return
     */
    public boolean isExpired() {
        return System.currentTimeMillis() > expiresTime;
    }

}
